-
Notifications
You must be signed in to change notification settings - Fork 70
hw-isolation rebase: Added guard, deconfiguration, sparecore #1279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
gcpin
commented
May 7, 2025
Can one of the admins verify this patch? |
add to approvelist |
asyncResp->res.jsonValue[errorLogPropPath]["@odata.id"] = | ||
boost::urls::format( | ||
"/redfish/v1/Systems/system/LogServices/{}/Entries/{}{}", | ||
logPath, entryID, linkAttachment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is better to be
asyncResp->res.jsonValue[errorLogPropPath]["@odata.id"] =
boost::urls::format(
"/redfish/v1/Systems/{}/LogServices/{}/Entries/{}{}",
BMCWEB_REDFISH_SYSTEM_URI_NAME,
logPath, entryID, linkAttachment);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Will push the changes together shortly
@@ -0,0 +1,690 @@ | |||
#pragma once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License statement
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright OpenBMC Authors
#pragma once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Will push the changes together shortly
#include <sdbusplus/message.hpp> | ||
#include <sdbusplus/message/native_types.hpp> | ||
#include <utils/error_log_utils.hpp> | ||
#include <utils/time_utils.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the above 2 include files would need to be (moved to the section L2-L7)
#include "utils/error_log_utils.hpp"
#include "utils/time_utils.hpp"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Will push the changes together shortly
}, | ||
"xyz.openbmc_project.ObjectMapper", | ||
"/xyz/openbmc_project/object_mapper", | ||
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better to be done with
dbus::utility::getSubTreePaths(...)
// the respective hardware is not functional so | ||
// set the state as "Disabled". | ||
asyncResp->res.jsonValue["Status"]["State"] = | ||
"Disabled"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncResp->res.jsonValue["Status"]["State"] = resource::State::Disabled;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Will push the changes together shortly
redfish-core/lib/memory.hpp
Outdated
inline void getObjectEnable(std::shared_ptr<bmcweb::AsyncResp> asyncResp, | ||
const std::string& service, const std::string& path) | ||
{ | ||
sdbusplus::asio::getProperty<bool>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getProperty<bool>()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
return; | ||
} | ||
sdbusplus::asio::getProperty<std::string>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getProperty<bool>()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, | ||
const std::string& entryId, std::function<void(bool hidden)>&& callback) | ||
{ | ||
sdbusplus::asio::getProperty<bool>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getProperty<bool>()
} | ||
|
||
// Get event properties and fill into status conditions | ||
sdbusplus::asio::getAllProperties( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
dbus::utility::getAllProperties
"LogServices/HardwareIsolation"}}); | ||
asyncResp->res.jsonValue["[email protected]"] = | ||
logServiceArrayLocal.size(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better like to in the older #1256
if constexpr (BMCWEB_HW_ISOLATION)
{
nlohmann::json& logServiceArrayLocal =
asyncResp->res.jsonValue["Members"];
nlohmann::json::object_t member;
member["@odata.id"] = boost::urls::format(
"redfish/v1/Systems/{}/LogServices/HardwareIsolation",
BMCWEB_REDFISH_SYSTEM_URI_NAME);
logServiceArrayLocal.emplace_back(std::move(member));
asyncResp->res.jsonValue["[email protected]"] =
logServiceArrayLocal.size();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
crow::connections::systemBus->async_method_call( | ||
[asyncResp, resourceObjPath]( | ||
const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetAncestorsResponse& ancestors) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this code is being carried forward from prior releases. But in its current format it goes against the OpenBMC coding standards. Specifically using long lambdas. Suggest cleaning this up to move into a named function instead.
(Same comment applies throughout this file and much of this review.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will defer this. Created another JIRA to address moving of lambdas to function. Will attach it to the main conversation
// for parent chassis object id alone, so we should get one | ||
// element. | ||
BMCWEB_LOG_ERROR( | ||
"The given resource object [{}] is contains more than one Chassis as parent so failed return ChassisPowerStateOffRequiredError in the response", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraneous word: "is"
if (severityVal == | ||
"xyz.openbmc_project.Logging.Event.SeverityLevel.Critical") | ||
{ | ||
asyncResp->res.jsonValue[severityPropPath] = "Critical"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these strings map to generated Redfish enums?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// MessageRegistries | ||
std::vector<std::string> messageArgs{*msgPropVal}; | ||
|
||
// Fill the "msgPropVal" as reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this use the utility function fillMessageArgs() instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will also address this as part of the new JIRA
redfish-core/lib/memory.hpp
Outdated
* @brief API used to process the Memory "Enabled" member which is | ||
* patched to do appropriate action. | ||
* | ||
* @param[in] resp - The redfish response to return. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: comment doesn't match name of parameter
crow::connections::systemBus->async_method_call( | ||
[asyncResp, dbusObjPath, | ||
entryJsonIdx](const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetObject& objType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really long lambda. It would be better to put it into a named function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will address this in a separate commit. Attached JIRA ticket for reference
} | ||
|
||
// Fill the isolated hardware object id along with the Redfish URI | ||
std::string redfishUri = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use std::format() here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
severityString == | ||
"xyz.openbmc_project.HardwareIsolation.Entry.Type.Spare") | ||
{ | ||
entryJson["Severity"] = "OK"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this use a generated Redifsh enum?
crow::connections::systemBus->async_method_call( | ||
[asyncResp, entryId, | ||
entryObjPath](const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetObject& objType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file also has lots of long lambdas which would benefit the readability to move into named functions per the coding guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will address in the next commit. Attached JIRA ticket details for reference
.methods(boost::beast::http::verb::get)( | ||
getSystemHardwareIsolationLogEntryCollection); | ||
|
||
BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better for searching the code if the Redfish URI path string was all in a single string. Same comment below.
jenkins run tests please |
24457ee
to
7512534
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the comments. I have addressed almost all of them except that ones that include changes to convert the lambdas into named function. Please review it. I will get the JIRA details from my team and attach it shortly. (by our tomorrow morning)
} | ||
|
||
// Fill the isolated hardware object id along with the Redfish URI | ||
std::string redfishUri = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
return; | ||
} | ||
sdbusplus::asio::getProperty<std::string>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,82 @@ | |||
#pragma once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
crow::connections::systemBus->async_method_call( | ||
[asyncResp, resourceObjPath]( | ||
const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetAncestorsResponse& ancestors) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will defer this. Created another JIRA to address moving of lambdas to function. Will attach it to the main conversation
}, | ||
"xyz.openbmc_project.ObjectMapper", | ||
"/xyz/openbmc_project/object_mapper", | ||
"xyz.openbmc_project.ObjectMapper", "GetObject", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (severityVal == | ||
"xyz.openbmc_project.Logging.Event.SeverityLevel.Critical") | ||
{ | ||
asyncResp->res.jsonValue[severityPropPath] = "Critical"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}, | ||
"xyz.openbmc_project.ObjectMapper", | ||
"/xyz/openbmc_project/object_mapper", | ||
"xyz.openbmc_project.ObjectMapper", "GetObject", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
"LogServices/HardwareIsolation"}}); | ||
asyncResp->res.jsonValue["[email protected]"] = | ||
logServiceArrayLocal.size(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
crow::connections::systemBus->async_method_call( | ||
[asyncResp, dbusObjPath, | ||
entryJsonIdx](const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetObject& objType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will address this in a separate commit. Attached JIRA ticket for reference
crow::connections::systemBus->async_method_call( | ||
[asyncResp, entryId, | ||
entryObjPath](const boost::system::error_code& ec, | ||
const dbus::utility::MapperGetObject& objType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will address in the next commit. Attached JIRA ticket details for reference
redfish-core/lib/processor.hpp
Outdated
{ | ||
getEnabledStatus(asyncResp, service, corePath, intf); | ||
} | ||
#ifdef BMCWEB_ENABLE_HW_ISOLATION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
if constexpr (BMCWEB_HW_ISOLATION)
{
// Check for the hardware status event
hw_isolation_utils::getHwIsolationStatus(asyncResp, corePath);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
redfish-core/lib/processor.hpp
Outdated
} | ||
}; | ||
|
||
getProcessorPaths(asyncResp, processorId, std::move(callback)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since callback is small, I think it is better to be inlined as a lambda body
getProcessorPaths(asyncResp, processorId,
[asyncResp, coreId, enabled](const std::string& cpuPath) {
// Handle patched Enabled Redfish property
if (enabled.has_value())
{
patchCpuCoreMemberEnabled(asyncResp, cpuPath, coreId, *enabled);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
include/dbus_utility.hpp
Outdated
@@ -179,6 +179,11 @@ void getDbusObject(const std::string& path, | |||
std::function<void(const boost::system::error_code&, | |||
const MapperGetObject&)>&& callback); | |||
|
|||
void getAncestor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it is matching with "GetAncestors" dbus-call, I think it is better to be named as getAncestors()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
redfish-core/lib/assembly.hpp
Outdated
// Assembly | ||
// GET and | ||
// PATCH | ||
// handler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge the above comment line L838-L852 into a line and rerun `clang-format-19' to squeeze them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// name, | ||
// object | ||
// path, and | ||
// interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge the comment of lines L333-L340 (and then rerun clang-format-19)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
BMCWEB_ROUTE( | ||
app, | ||
"/redfish/v1/Systems/<str>/LogServices/HardwareIsolation/Actions/LogService.ClearLog/") | ||
.privileges(redfish::privileges::postLogService) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be
.privileges(redfish::privileges::
postLogServiceSubOverComputerSystemLogServiceCollection)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/dbus_utility.cpp
Outdated
@@ -224,6 +224,22 @@ void getDbusObject(const std::string& path, | |||
"xyz.openbmc_project.ObjectMapper", "GetObject", path, interfaces); | |||
} | |||
|
|||
void getAncestor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAncestors()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// implemented before | ||
// finding the assembly id | ||
// as per bmcweb Assembly | ||
// design. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also combine the above L787-L793 comment lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
``` 1. Add support for guard, deconfiguration and sparecore 2. hw-isolation code relocation to systems_logservices_hwisolation.hpp Following commits from 1110 are used to create this unified commit 332c310 - redfish-core: LogServices: Added HardwareIsolation service 36dec57 - LogServices: HardwareIsolation: LogEntryCollection 3486c6a - LogServices: HardwareIsolation: Get LogEntry 3d981ef - LogServices: HardwareIsolation: Delete LogEntry 11e4cda - LogServices: HardwareIsolation: Post ClearLog 723c0fd - redfish-core: Core: Enabled the isolation feature e4cb163 - redfish-core: Memory:Enabled the isolation feature e2158ab - Core: Fix, Patch a core into the respective parent processor 4237af3 - Hw-Isolation: Deconfiguration type for DIMMs 21582d8 - Enabled deconfiguration reason support to the DIMM 558b32f - HW-Isolation: Fix, Don't throw internal error if failed to get error log 2ae01ea - HW-Isolation: Fix, Update State if the Core and DIMM are recovered 84aef9b - HW-Isolation: Return an appropriate error if the request is failed. 9ac66c5 - HW-Isolation: Return ResourceCannotBeDeleted error f769499 - LogService: HW-Isolation: Return an appropriate error c3839db - redfish-core: Core: Enabled the isolation (aka guard) feature 555fc6c - HW-Isolation: Fix, Use GetAncestors to get the parents id 2cf7c3f - HW-Isolation: Fill OriginOfCondition for the TPM and Motherboard 3bd202e - LogEntry: HW-Isolation: Removed the Resolved property 10ed043 - HardwareIsolation: Spare core support 5e53b61 - HW-Isolation: Fix info PEL AdditionalDataURI 50c9dc3 - HW-Isolation: Fix Additional Data Uri 7adcfa1 - Move getHiddenPropertyValue method to utils b90a99f - Hw-Isolation: Fix eventId HW Deconfiguration page ``` Signed-off-by: Gopichand Paturi <[email protected]> Co-authored-by: Ramesh Iyyar <[email protected]> Co-authored-by: deepakala k <[email protected]>
7512534
to
bcebe75
Compare
Thank you reviewing with close attention. I have addressed all the comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks much better and I think it can go in.
(Later more to be refined and enhanced).
@baemyung I captured all the comments that are yet to be addressed in this JIRA. https://jsw.ibm.com/browse/PFEBMC-4397 |
return; | ||
} | ||
|
||
asyncResp->res.jsonValue["Enabled"] = enabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "Enabled" field requires Memory schema version v1_12_0.
asyncResp->res.jsonValue["Members"]; | ||
nlohmann::json::object_t member; | ||
member["@odata.id"] = boost::urls::format( | ||
"redfish/v1/Systems/{}/LogServices/HardwareIsolation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validator fails because of a missing "/" in front of this.
member["@odata.id"] = boost::urls::format(
"/redfish/v1/Systems/{}/LogServices/HardwareIsolation",